﻿<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
	<!-- 包含公共的JSP代码片段 -->

	<title>餐馆王平台</title>


<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="${ctx}/style/js/jquery.js"></script>
<script type="text/javascript" src="${ctx}/style/js/page_common.js"></script>
<link href="${ctx}/style/css/common_style_blue.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="${ctx}/style/css/index_1.css" />

</head>
<body>
<!-- 页面标题 -->
<div id="TitleArea">
	<div id="TitleArea_Head"></div>
	<div id="TitleArea_Title">
		<div id="TitleArea_Title_Content">
			<img border="0" width="13" height="13" src="${ctx}/style/images/title_arrow.gif"/> 餐桌列表
		</div>
	</div>
	<div id="TitleArea_End"></div>
</div>


<!-- 过滤条件 -->
<div id="QueryArea">
	<form action="/table" method="get">
		<input type="hidden" name="method" value="search">
		<input type="text" name="dtName" value="${dtName}" placeholder="请输入餐桌名称" title="请输入餐桌名称">
		<input type="submit" value="搜索">
	</form>
</div>


<!-- 主内容区域（数据列表或表单显示） -->
<div id="MainArea">
    <table class="MainArea_Content" cellspacing="0" cellpadding="0">
        <!-- 表头-->
        <thead>
            <tr align="center" valign="middle" id="TableTitle">
				<td>编号</td>
				<td>桌名</td>
				<td>状态</td>
				<td>预定时间</td>
				<td>操作</td>
			</tr>
		</thead>	
		<!--显示数据列表 -->
        <tbody id="TableData">
			<c:forEach items="${types}" var="type" varStatus="vs">
				<tr class="TableDetail1">
					<td align="center">${vs.index + 1}&nbsp;</td>
					<td align="center">${type.dtName}&nbsp;</td><span id="tableMsg"></span><br/>
					<c:if test="${type.dtState == 0}">
						<td align="center">空闲</td>
					</c:if>
					<c:if test="${type.dtState == 1}">
						<td align="center">已预定</td>
					</c:if>
					<td align="center">${type.dtPresetTime}&nbsp;</td>
					<td>
						<c:if test="${type.dtState == 1}">
							<a href="/table?method=update&dtId=${type.dtId}&state=${type.dtState}" class="FunctionButton" onClick="quit()">退桌</a>
						</c:if>
						<c:if test="${type.dtState == 0}">
							<a href="/table?method=update&dtId=${type.dtId}&state=${type.dtState}" onClick="book()" class="FunctionButton">预定</a>
						</c:if>
						<c:if test="${type.dtState == 0}">
							<a href="/table?method=del&dtId=${type.dtId}" onClick="del()" class="FunctionButton">删除</a>
						</c:if>
						<c:if test="${type.dtState == 1}">
							<a href="" class="FunctionButton" onclick="delHint()">删除</a>
						</c:if>
					</td>
				</tr>
			</c:forEach>
        </tbody>
    </table>
	
   <!-- 其他功能超链接 -->
	<div id="TableTail" align="center">
		<div class="FunctionButton">
			<a href="${ctx}/table/table-save.jsp">添加</a>
		</div>
    </div> 
</div>
</body>
<script>
	function book() {
		alert('是否要预订该餐桌！')
	}
	function quit() {
		alert('是否要取消预订！')
	}
	function del() {
		alert('是否要删除该餐桌！')
	}
	function delHint() {
		alert('该餐桌已被预订，不能删除！！！')
	}
</script>
</html>
